home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
R-Shows
/
(c)sdg.d64
/
fast tools plus
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
18KB
|
280 lines
0 REM - WON'T WORK WITH BUSCARD 'ON'
1 GOTO 500
10 REM :::::: ZAP!
11 A=256: B=2049: C=1003
12 IF PEEK(B+2) +A*PEEK(B+3)>=C THEN 15
13 B=PEEK(B)+A*PEEK(B+1): ON ABS(B<>0) GOTO 12:END
14 A=256:B=PEEK(251)+A*PEEK(252)
15 IF PEEK(B+1)=0 THEN END
16 PRINT CHR$(147)PEEK (B+2)+A*PEEK(B+3):PRINT "GOTO 14"
17 POKE 251,B-INT(B/A)*A:POKE 252,B/A
18 POKE 631,19:POKE632,13:POKE633,13:POKE198,3:END
20 REM ... GRAPHICS
21 POKE 53265,59
22 POKE 53272,29
23 POKE 56576,198
24 RETURN
30 REM ... TEXT
31 POKE 53265,27
32 POKE 53272,21
33 POKE 56576,199
34 RETURN
40 REM :::: COLOURS
41 SYS 49165,C
44 RETURN
50 REM ::::::: PAINT BACKGROUND
51 SYS 49157
54 RETURN
60 REM ::::::: FIND A POINT
61 ROW = INT(Y/8)
62 COL = INT(X/8)
63 LINE = Y AND 7
64 BIT = 7-(XAND7)
65 BYTE = 24576 + ROW*320 + COL*8 + LINE
66 CBYTE = 17408 + ROW * 40 + COL
67 RETURN
70 REM ::::::: PLOT A POINT
71 SYS 49321,X,Y,C
74 RETURN
80 REM ::::: PLOT A LINE
81 SYS 49321,X1,Y1 TO X2,Y2,C
89 RETURN
90 REM ::::: PAINT A SHAPE
91 SYS 49551,X0,Y0,W,H,C,PC
99 RETURN
100 REM ::::: SAVE PICTURE
101 INPUT "ENTER FILE NAME";FILE$
102 INPUT "ENTER 8 FOR DISK, OR 1 FOR CASSETTE"; DE
103 SYS 57812 FILE$ + ".PIC", DE
104 POKE 174,64:POKE 175,127:POKE 193,0:POKE 194,96
105 SYS 62954
106 SYS 57812 FILE$ + ".COL", DE
107 POKE 174,232: POKE 175,71: POKE193,0: POKE 194,68
108 SYS 62954: END
110 REM ::::: DRAW A SHAPE
111 FOR J = 0 TO NL
112 E1 = L%(0,J): E2 = L%(1,J)
113 X1 = E%(0,E1) + X0: Y1 = E%(1,E1) + Y0
114 X2 = E%(0,E2) + X0: Y2 = E%(1,E2) + Y0
115 GOSUB 80
116 NEXT J
117 RETURN
120 REM ::::: DEFINE SPRITE SP
121 FOR I = 0 TO 62
122 READ A
123 POKE 16384 + 64*SP+I,A
124 NEXT I
125 POKE 18424 + SP,SP
126 RETURN
130 REM ::::: TURN ON SPRITE SP
131 POKE 53269, PEEK(53269)OR 2^SP
132 RETURN
140 REM ::::: TURN OFF SPRITE SP
141 POKE 53269,PEEK(53269)AND(255-2^SP)
142 RETURN
150 REM ::::: X EXPAND SPRITE SP
151 POKE 53277,PEEK(53277)OR2^SP
152 RETURN
160 REM ::::: X UNEXPAND SPRITE SP
161 POKE 53277,PEEK(53277)AND(255-2^SP)
170 REM ::::: Y EXPAND SPRITE SP
171 POKE 53271,PEEK(53271)OR 2^SP
172 RETURN
180 REM ::::: Y UNEXPAND SPRITE SP
181 POKE 53271,PEEK(53271)AND(255-2^SP)
182 RETURN
190 REM :: SPRITE SP PRIORITY OVER SHAPE
191 POKE 53275,PEEK(53275)AND(255-2^SP)
192 RETURN
200 REM :: SHAPE PRIORITY OVER SPRITE SP
201 POKE 53275,PEEK(53275)OR 2^SP
202 RETURN
210 REM ::: SET SPRITE SP TO COLOUR C
211 POKE 53287 + SP,C
212 RETURN
220 REM :: PLACE SPRITE SP AT X,Y
221 XX=X+24:YY=Y+50:Z%=XX/256
222 V=XX-Z%*256:W=53248+SP*2
223 WW=53264
224 PR=ABS((PEEK(WW)AND 2^SP)<>0)
225 VV=PEEK(WW)AND(255-2^SP)OR(2^SP*Z%)
226 IF PR<>Z%THEN GOSUB140
227 POKE W,V:POKEWW,VV: GOSUB 130
228 POKE 53249+SP*2,YY
229 RETURN
240 REM ::: DRAW A RECTANGLE
241 X1=X0+W:Y1=Y0
242 X2=X0:Y2=Y0:GOSUB 80
243 X1=X0:Y1=Y0+H:GOSUB80
244 X2=X0+W:Y2=Y0+H:GOSUB 80
245 X1=X0+W:Y1=Y0:GOSUB 80
246 RETURN
250 REM ::: DRAW/PAINT RECTANGLE
251 GOSUB 240
252 GOTO 90
260 REM ::: DRAW A POLYGON
261 K=2*(null)/T-.0001
262 FOR J = 0 TO 2*(null)STEPK
263 W=R*SIN(J)*1.2345
264 H=R*COS(J)*SC
265 IF J=0 THEN X1=X0+W:Y1=Y0+H
266 X2=X0+W:Y2=Y0+H:GOSUB80
267 X1=X2:Y1=Y2
268 NEXT J
269 RETURN
270 REM ::: DRAW/PAINT POLYGON
271 GOSUB 260
272 X0=X0-R*1.2345
273 Y0=Y0-R*SC
274 H=R*2*SC
275 W=R*2*1.2345
276 GOTO 90
280 REM ::: DRAW A CIRCLE
281 T=30
282 GOTO 260
290 REM ::: PRINT PICTURE
291 OPEN 1,4:BA=24888
292 A$=CHR$(15)+CHR$(16)+"20"+CHR$(8)
293 FORJ=0TO44:IF(JAND7)>0THENBA=BA-8
294 BY=BA:PRINT#1,A$;
295 B1%=JAND7:B2%=8-B1%:FORK=0TO199
296 T=PEEK(BY)*2^B1%AND127
297 B=INT(PEEK(BY+8)/2^B2%)
298 PRINT#1,CHR$(128+T+B);
299 BY=BY+1:IF(KAND7)=7THEN BY=BY+312
300 NEXTK:PRINT#1:NEXTJ:CLOSE1
500 FOR I = 49152 TO 49189
501 READ A: POKE I,A: T=T+A
502 NEXT I
503 IF T<>5205 THEN PRINT"ERROR IN 500-516":STOP
504 T=0
510 REM ::::: CLEAR AND PAINT
511 DATA 134, 32, 0, 0, 0,169, 0
512 DATA 160, 96,162, 32,208, 8, 32
513 DATA 241,183,138,160, 68,162, 4
514 DATA 132,252,160, 0,132,251,145
515 DATA 251,200,208,251,230,252,202
516 DATA 208,246, 96
520 FOR I = 49190 TO 49263
521 READ A: POKE I,A: T=T+A
522 NEXT I
523 IF T<>8819 THEN PRINT"ERROR IN 520-541":STOP
524 T=0
530 REM :::: FIND A POINT
531 DATA 173, 62, 3, 72, 41,248,168
532 DATA 32,162,179,169, 0,160,192
533 DATA 32, 40,186, 32,247,183, 24
534 DATA 173, 60, 3, 72, 41,248,101
535 DATA 20,133,251,133,253,173, 61
536 DATA 3,101, 21, 72, 74,102,253
537 DATA 74,102,253, 74,102,253, 24
538 DATA 105, 68,133,254,104,105, 96
539 DATA 133,252,104, 41, 7,170,104
540 DATA 41, 7,101,251,144, 2,230
541 DATA 252,133,251, 96
550 FOR I = 49264 TO 49367
551 READ A: POKE I,A: T=T+A
552 NEXT I
553 IF T<>10943 THEN PRINT"ERROR IN 550-575":STOP
554 T=0
560 REM :::: MISC. ROUTINES
561 DATA 162, 64, 44,162, 69, 44,162
562 DATA 74, 44,162, 79, 44,162, 84
563 DATA 160, 3, 76,212,187,169, 64
564 DATA 44,169, 69, 44,169, 84,160
565 DATA 3, 76,162,187, 32,124,192
566 DATA 32,247,183,166, 20,164, 21
567 DATA 142, 89, 3,140, 90, 3, 96
568 DATA 128, 64, 32, 16, 8, 4, 2
569 DATA 1, 32,253,174, 32,235,183
570 DATA 142, 62, 3,166, 20,164, 21
571 DATA 142, 60, 3,140, 61, 3,201
572 DATA 164,240, 24, 32,241,183,142
573 DATA 63, 3, 32, 38,192,160, 0
574 DATA 177,251, 29,161,192,145,251
575 DATA 173, 63, 3,145,253, 96
580 FOR I = 49368 TO 49444
581 READ A: POKE I,A: T=T+A
582 NEXT I
583 IF T<>7925 THEN PRINT"ERROR IN 580-601":STOP
584 T=0
590 REM :::: PLOT PART 1
591 DATA 32,115, 0, 32,138,173, 32
592 DATA 15,188,172, 60, 3,173, 61
593 DATA 3, 32,145,179, 32,112,192
594 DATA 32, 83,184, 32,118,192, 70
595 DATA 102, 32,144,192, 32,241,183
596 DATA 138,168, 32,162,179, 32, 15
597 DATA 188,172, 62, 3, 32,162,179
598 DATA 32,115,192, 32, 83,184, 32
599 DATA 121,192, 70,102,169, 84,160
600 DATA 3, 32, 91,188, 48, 11, 32
601 DATA 43,188,208, 3, 76,192,192
610 FOR I = 49445 TO 49550
611 READ A: POKE I,A: T=T+A
612 NEXT I
613 IF T<>11077THEN PRINT"ERROR IN 610-636":STOP
614 T=0
620 REM :::: PLOT PART 2
621 DATA 32,144,192, 32,137,192,169
622 DATA 74,160, 3, 32, 15,187, 32
623 DATA 118,192, 32,137,192,169, 79
624 DATA 160, 3, 32, 15,187, 32,121
625 DATA 192, 32,241,183,142, 63, 3
626 DATA 32,198,192, 32,131,192,169
627 DATA 74,160, 3, 32,103,184, 32
628 DATA 43,188, 48, 52, 32,112,192
629 DATA 32,247,183,165, 20,166, 21
630 DATA 141, 60, 3,142, 61, 3, 32
631 DATA 134,192,169, 79,160, 3, 32
632 DATA 103,184, 32, 43,188, 48, 21
633 DATA 32,115,192, 32,247,183,165
634 DATA 20,141, 62, 3,206, 89, 3
635 DATA 208,191,206, 90, 3, 16,186
636 DATA 96
640 FOR I=49551 TO 49658
641 READ A: POKE I,A: T=T+A
642 NEXT I
643 IF T<>9829 THEN PRINT"ERROR IN 640-666":STOP
644 T=0
650 REM :::: PAINT A SHAPE PART 1
651 DATA 32, 89,194,141, 60, 3,140
652 DATA 61, 3,142, 66, 3, 32, 89
653 DATA 194,141, 64, 3,140, 65, 3
654 DATA 142, 67, 3, 32,241,183,142
655 DATA 63, 3, 32,253,174, 32,138
656 DATA 173, 32,118,192,169, 0,141
657 DATA 72, 3,141, 73, 3,173, 66
658 DATA 3,141, 69, 3,173, 67, 3
659 DATA 141, 68, 3,173, 69, 3,141
660 DATA 62, 3, 32, 38,192,160, 0
661 DATA 177,251, 61,161,192,208, 52
662 DATA 173, 73, 3,240, 34,169, 0
663 DATA 141, 73, 3,173, 72, 3,208
664 DATA 16,173, 69, 3,141, 70, 3
665 DATA 169, 1,141, 71, 3,141, 72
666 DATA 3,208, 8
670 FOR I=49659 TO 49763
671 READ A: POKE I,A: T=T+A
672 NEXT I
673 IF T<>11207THEN PRINT"ERROR IN 670-695":STOP
680 REM :::: PAINT A SHAPE PART 2
681 DATA 32, 59,194,169, 0,141, 72
682 DATA 3,238, 69, 3,238, 71, 3
683 DATA 206, 68, 3,208,188,240, 21
684 DATA 169, 1,141, 73, 3,238, 69
685 DATA 3,206, 68, 3,208,173,173
686 DATA 72, 3,240, 3, 32, 59,194
687 DATA 238, 60, 3,208, 3,238, 61
688 DATA 3,206, 64, 3,208,132,206
689 DATA 65, 3, 48, 3, 76,182,193
690 DATA 96,173, 70, 3,141, 62, 3
691 DATA 32,190,224,169, 74,160, 3
692 DATA 32, 91,188, 16, 3, 32,198
693 DATA 192,238, 62, 3,206, 71, 3
694 DATA 208,233, 96, 32,253,174, 32
695 DATA 235,183,165, 20,164, 21, 96
1000 REM :::::
1001 REM MAIN ROUTINE
1002 REM :::::